package com.ruoyi.system.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.CommonDto;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.SysMsg;
import com.ruoyi.system.service.SysExcelservice;
import com.ruoyi.system.service.SysMsgService;
import com.ruoyi.system.vo.req.AnalyExcelReqVO;
import com.ruoyi.system.vo.resp.AnalysisRespVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author xdh
 * @title SysExcelController
 * @date 2024/7/1 14:03
 * @description TODO
 */
@RestController
@RequestMapping("/msg")
@Api(tags = "消息中心相关接口")
public class SysMsgController {


    @Autowired
    private SysMsgService sysMsgservice;


    //@RequiresPermissions("system:msg:page")
    @PostMapping("/page")
    @ApiOperation("消息列表")
    public R<IPage<SysMsg>> page(@RequestBody CommonDto dto) {
        return R.ok(sysMsgservice.pageMsg(dto));
    }

    @GetMapping("/get")
    @ApiOperation("获取未读条数")
    public R<Integer> get(){
        return R.ok(sysMsgservice.get());
    }

    @GetMapping("/all")
    @ApiOperation("全部标记已读")
    public R<Boolean> all() {
        return R.ok(sysMsgservice.all());
    }

    @GetMapping("/info")
    @ApiOperation("标记已读")
    public R<Boolean> info(Integer msgId) {
        return R.ok(sysMsgservice.info(msgId));
    }


//    @RequiresPermissions("system:msg:page")
//    @PostMapping("/page")
//    public R<Page<SysMsg>> page(@RequestBody CommonDto dto) {
//        return R.ok(sysMsgservice.pageMsg(dto));
//    }


}
